﻿@model DeviceFinder.Models.DeviceModel
@{
    ViewBag.Title = "Add Device";
}
@{Html.RenderPartial("../Shared/UserCPLeftMenu");}
<h2>
    Add Device</h2>
@{
    string url = HttpContext.Current.Request.Url.AbsoluteUri.Replace(HttpContext.Current.Request.Url.AbsolutePath, "");
}
@using (Html.BeginForm("AddDevice", "User", FormMethod.Post))
{
    if (ViewData["Result"] != null)
    {
        if (ViewData["Result"].ToString().ToLower().Contains("success"))
        {        
    <p id="result" style="color: Green">@ViewData["Result"]</p>
    <p style="color: Red">
        <b>You have to set this page is Homepage of your browser :</b></p>

    <p>
        <b><a href="@url/User/HomePage/@ViewBag.ID">@url/User/HomePage/@ViewBag.ID</a></b></p>
    <br />
    <p>
        How to change Homepage:</p>
    <p>
        For IE : <a href="http://support.microsoft.com/kb/252464">Click Here to view</a></p>
    <p>
        For Google : <a href="http://support.google.com/chrome/bin/answer.py?hl=en&answer=95314">
            Click Here to view</a></p>
    <p>
        For Firefox : <a href="http://support.mozilla.org/en-US/kb/How%20to%20set%20the%20home%20page">
            Click Here to view</a></p>
    <script>
        window.open('@Url.Content("~/User/Message/")@ViewBag.ID', 'popup', 'width=600,height=600,scrollbars=no,resizable=no,toolbar=no,directories=no,location=no,menubar=no,status=no,left=0,top=0');
    </script>
        }
        else
        {            
    <p id="result" style="color: Red">@ViewData["Result"]</p>
        }
    }
    <fieldset>
        <legend>Change Password Form</legend>
        <ol>
            <li>
                @Html.LabelFor(m => m.Name)
                @Html.TextBoxFor(m => m.Name)
                @Html.ValidationMessageFor(m => m.Name)
            </li>
            <li>
                @Html.LabelFor(m => m.Type)
                @Html.TextBoxFor(m => m.Type)
                @Html.ValidationMessageFor(m => m.Type)
            </li>
            <li>
                @Html.LabelFor(m => m.HomePage)
                @Html.TextBoxFor(m => m.HomePage)
                @Html.ValidationMessageFor(m => m.HomePage)
            </li>
            <li>
                @Html.LabelFor(m => m.WebcamCapture)
                @Html.TextBoxFor(m => m.WebcamCapture)
                @Html.ValidationMessageFor(m => m.WebcamCapture)
            </li>
            <li>
                @Html.LabelFor(m => m.IsFollow)
                @Html.CheckBoxFor(m => m.IsFollow)
                @Html.ValidationMessageFor(m => m.Type)
            </li>
            <li>
                @Html.LabelFor(m => m.IsActiveCommand)
                @Html.CheckBoxFor(m => m.IsActiveCommand)
                @Html.ValidationMessageFor(m => m.IsActiveCommand)
            </li>
            <li>
                @Html.LabelFor(m => m.Description)
                @Html.TextBoxFor(m => m.Description)
            </li>
        </ol>
        <input id="submitbtn" type="image" src="../../Images/add-device-btn.png" alt="Submit Button" />
        <script type="text/javascript">
            $("#submitbtn").click(function () {
                $("#result").html(" ");
            });
        </script>
    </fieldset>
    
    <input type="hidden" id="EmailUser" name="EmailUser" value="@Model.EmailUser"/>
}